# coding:utf-8
import re
def filter_function(filename,window_size,p,q):
    data_stream = open(filename,"rb")
    data_result = ""
    sequence = data_stream.read()
    segements = len(sequence) / window_size
    for offset in xrange(0, segements):
        (r_p,r_q) = vlogic_analyze.process_type3(sequence[offset:offset+window_size])
        if r_p == p and r_q == q:
            data_result += sequence[offset:offset+window_size]
    

    result_file = open("result","wb")


def main():
    # filter_function("/home/development/vlogic_new/data/",8,4,1)
    filepath = '/Users/houseyoung/Documents/development/vlogic_new/data/quantum/data1/13.char'
    infile = open(filepath,'rb')
    out_file = open(filepath+"std","wa")
    pattern = re.compile("\d{8}")
    for line in infile.readlines():
        datas = pattern.findall(line)
        out_file.write("".join(datas))
    
    infile.close()
    out_file.close()

if __name__ == '__main__':
    main()



